<?php

use common\lib\defaultHtml;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('app', 'Employees');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="employees-index">

    <div class="row">
        <div class="col-md-4 btn-group">
            <?= defaultHtml::a(Yii::t('app', 'Create Icon'), ['create'], ['class' => 'btn btn-sm btn-success']) ?>
            <?= defaultHtml::a(Yii::t('app', 'Delete Icon'), 'javascript:void(0);', ['class' => 'delete btn btn-sm btn-danger', 'url' => 'delete']) ?>
        </div>
        <div class="col-md-2 col-md-offset-6">
            <?= defaultHtml::searchInput('keyword', Yii::t('app', 'Search Icon'), $keyword, ['class' => 'form-control', 'placeHolder' => '手机/工号'], ['class' => "search btn btn-info", 'type' => 'button', 'url' => 'index']) ?>
        </div>
    </div>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            [
                'class' => 'yii\grid\CheckboxColumn',
                'name' => 'selectIds',
                'options' => ['id' => 'grid'],
                'headerOptions' => ['width' => '30']
            ],
            ['attribute' => 'employeeId', 'value' => function($model){return empty($model->employeeId) ? '' : $model->employeeId;}],
            ['attribute' => 'mobile', 'value' => function($model){return empty($model->mobile) ? '' : $model->mobile;}],
            ['attribute' => 'workNo', 'value' => function($model){return empty($model->workNo) ? '' : $model->workNo;}],
            ['attribute' => 'regTime', 'value' => function($model){return empty($model->regTime) ? '' : date('Y-m-d H:i:s', $model->regTime);}],
            [
                'class' => 'yii\grid\ActionColumn',
                'header' => '<div class="text-center">操作</div>',
                'template' => '<div class="btn-group">{update}</div>',
                'buttons' => [
                    'update' => function ($url, $model, $key) {return defaultHtml::a('<span class="fa fa-cog"></span> 更新', $url, ['title' => '更新配置', 'class' => 'btn btn-xs  btn-info']);},
                ],
                'headerOptions' => ['width' => '120'],
            ],
        ],
    ]); ?>


</div>
